package ma.co.ba.BusinessApplications.model;

import java.io.Serializable;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table(name = "CLIENTS")
public class Client implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private int id;

	@Column(name = "IDENTIFIANT_CLIENT", nullable = false, length = 100)
	private String identifiantClient;

	@Column(name = "NOM_CLIENT", nullable = false, length = 100)
	private String nomClient;

	@Column(name = "ADRESSE", length = 250)
	private String adresse;

	@Column(name = "TELEPHONE", length = 15)
	private String telephone;

	@Column(name = "FAX", length = 15)
	private String fax;

	@Column(name = "ACTIF")
	private boolean actif = true;

	@OneToMany(mappedBy = "client", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
	private List<DAT> dats;

	@OneToMany(mappedBy = "client", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
	private List<Contact> contacts;
	
	@OneToMany(mappedBy="client", fetch=FetchType.LAZY)
	private List<Projet> projets;
	
	@OneToMany(mappedBy="client", fetch=FetchType.LAZY)
	private List<Mission> missions;

	public Client() {
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public List<Contact> getContacts() {
		return contacts;
	}

	public void setContacts(List<Contact> contacts) {
		this.contacts = contacts;
	}

	public String getAdresse() {
		return adresse;
	}

	public void setAdresse(String adresse) {
		this.adresse = adresse;
	}

	public List<DAT> getDats() {
		return dats;
	}

	public void setDats(List<DAT> dats) {
		this.dats = dats;
	}

	public static long getSerialversionuid() {
		return serialVersionUID;
	}

	public String getIdentifiantClient() {
		return identifiantClient;
	}

	public void setIdentifiantClient(String identifiantClient) {
		this.identifiantClient = identifiantClient;
	}

	public String getNomClient() {
		return nomClient;
	}

	public void setNomClient(String nomClient) {
		this.nomClient = nomClient;
	}

	public String getTelephone() {
		return telephone;
	}

	public void setTelephone(String telephone) {
		this.telephone = telephone;
	}

	public String getFax() {
		return fax;
	}

	public void setFax(String fax) {
		this.fax = fax;
	}

	public boolean isActif() {
		return actif;
	}

	public void setActif(boolean actif) {
		this.actif = actif;
	}

	public List<Projet> getProjets() {
		return projets;
	}

	public void setProjets(List<Projet> projets) {
		this.projets = projets;
	}

}